package com.fayou.data.nosqlredisdemo.controller;

import com.fayou.data.nosqlredisdemo.bean.User;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class HelloController {

    @GetMapping("testCache")
    @Cacheable(value = "user")
    public User testCache() throws InterruptedException {
        Thread.sleep(1000);
        return new User().setId(1).setSex("max").setUserName("fayou147");
    }
}
